package db.nio.test;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by root on 10/25/16.
 */
public class DbResult {
    private int code;
    private String message;
    private Map<Object,Object> data;

    public DbResult(){
    }

    public DbResult(String message){
        this.code = 0;
        this.message = message;
    }



    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Map<Object, Object> getData() {
        return data;
    }

    public void setData(Map<Object, Object> data) {
        this.data = data;
    }

    public <T> T get(Object key){
        return (T) data.get(key);
    }

    public void set(Object key,Object value){
        if(data == null){
            data = new HashMap<Object, Object>();
        }
        data.put(key,value);
    }
}
